<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Amaze UI Admin index Examples</title>
    <meta name="description" content="这是一个 index 页面">
    <meta name="keywords" content="index">
    <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="__PUBLIC__/seller/css/amazeui.min.css" />
	<link rel="stylesheet" href="__PUBLIC__/seller/css/admin.css">
	<link rel="stylesheet" href="__PUBLIC__/seller/css/app_1.css">
        <link rel="stylesheet" href="/Public/seller/js/confirm/jquery-confirm.min.css">
	<script src="__PUBLIC__/seller/js/jquery.min.js"></script>
	<script src="__PUBLIC__/seller/js/common.js"></script>
	<script src="__PUBLIC__/seller/js/confirm/jquery-confirm.min.js"></script>
	<script src="__PUBLIC__/seller/js/Validform_v5.3.2.js"></script>
        <link rel="stylesheet" href="__PUBLIC__/seller/css/validform.css" />
    <script src="assets/js/jquery.min.js"></script>

</head>

<body data-type="login">
    <script src="assets/js/theme.js"></script>
    <div class="am-g tpl-g">
        <!-- 风格切换 -->
        <div class="tpl-skiner">
            <div class="tpl-skiner-toggle am-icon-cog">
            </div>
            <div class="tpl-skiner-content">
                <div class="tpl-skiner-content-title">
                    选择主题
                </div>
                <div class="tpl-skiner-content-bar">
                    <span class="skiner-color skiner-white" data-color="theme-white"></span>
                    <span class="skiner-color skiner-black" data-color="theme-black"></span>
                </div>
            </div>
        </div>
        <div class="tpl-login">
            <div class="tpl-login-content"  >
                <div class="tpl-login-title">注册用户</div>
                <span class="tpl-login-content-info">
                  创建一个新的用户
              </span>


                <form class="am-form tpl-form-line-form" action=""  method="post" onsubmit="return check();">
                    <div class="am-form-group">
                        <input type="text" class="tpl-form-input" id="mobile" name="contact_tel" placeholder="手机号">
                    </div>
                   <div class="am-form-group" >
                                          
                       <input type="text" class="tpl-form-input"  style="float: left !important;width: 60%;" id="code" name="code" placeholder="验证码">
                   
                  
                         <button class="am-btn am-btn-default"  type="button"  data-type="orgin" id="get_checked">
                                                   获得验证码
                                   </button>
                       
                    </div>
                     <div class="am-form-group">
                        <input type="text" class="tpl-form-input" id="shop_name" name="shop_name" placeholder="商家名称">
                    </div>
                    <div class="am-form-group">
                        <select name="company_id" id="company_id">
                            <option value="0" id="company">请选择企业身份</option>
                            <volist name="company" id="val">
                                 <option value="{$val.id}">{$val.name}</option>
                            </volist>
                        </select>
                       
                    </div>
                    <div class="am-form-group">
                        <input type="text" class="tpl-form-input" id="username" name="username" placeholder="用户名">
                    </div>

                    <div class="am-form-group">
                        <input type="password" class="tpl-form-input" id="password" name="password" placeholder="请输入密码">
                    </div>

                    <div class="am-form-group">
                        <input type="password" class="tpl-form-input" id="cpassword" placeholder="再次输入密码">
                    </div>

                    <div class="am-form-group tpl-login-remember-me">
                        <input id="agreement" type="checkbox">
                        <label for="remember-me">
       
                        我已阅读并同意 <a href="javascript:;">《用户注册协议》</a> 
                         </label>

                    </div>

                    <div class="am-form-group">

                        <button type="submit" class="am-btn am-btn-primary  am-btn-block tpl-btn-bg-color-success  tpl-login-btn">提交</button>

                    </div>
                </form>
            </div>
        </div>
    </div>

    <script>
          //js路由
                function getUrl( method , attr) {
                    var url = '';
                    var mode = '{:C('URL_MODEL')}';
                    switch( mode ) {
                        case '1' :
                            var param = new Array();
                            var i = 0;
                            $.each( attr , function(k , v){
                                param[i] = k + '/' + v;
                                i++;
                            })
                            url = '/seller.php/' + method + '/' + param.join('/')+'.html'; 
                            break;
                       default :
                            var param = new Array();
                            var i = 0;
                            $.each( attr , function(k , v){
                                param[i] = k + '=' + v;
                                i++;
                            });
                            url = '/' + method + '.html?' + param.join('&'); 
                            break;
                    }
                    return url;
                }
        function check(){
            if($("#mobile").val()  == ''){
                error('手机号码不能为空');
                 return false;
            }
            if($("#code").val()  == ''){
                error('验证码不能为空');
                 return false;
            }
             if($("#shop_name").val()  == ''){
                error('商家名称不能为空');
                 return false;
            }
           if($("#company_id option:selected").val() == 0){
                 error('请绑定企业身份');
                 return false;
           }
            if($("#username").val()  == ''){
                error('用户名不能为空');
                 return false;
            }
          
            if($("#password").val()  == ''){
                error('密码不能为空');
                 return false;
            }
            if($("#password").val() != $("#cpassword").val()){
                error('两次密码输入不一致');
                 return false;
            }
            if(!($('#agreement').prop("checked"))){
                error('请同意用户注册协议！');
                 return false;
           }
     
        }
        
    $('button#get_checked').click(function(){
			var _self = $(this);
                                var mobile = $('#mobile').val();
                               
                                if( mobile == '' ) {
                                                error('手机号不能为空！');
                                                return false;
                                }
                                var url = getUrl('Public/mobileCheck',{'mobile':mobile});
				$.get( url , function( data ){
					if( data.status == 1 ) {
							success( '短信验证码发送成功' );
							var times = 30;
							_self.attr('disabled' , true);
							var timeIndex = setInterval(function(){
									if( times <= 0 ) {
										_self.text( '重新发送' ).attr('disabled' , false);
										clearInterval( timeIndex );
									} else {
										_self.text( times + ' s');
										times--;
									}
							}, 1000);
					} else {
							error( data.msg );	
					}
				} , 'json');
		});
    
    </script>
</body>

</html>